
<%@page import="fu.abc.DAO.CategoryDAO"%>
<%@page import="fu.abc.model.Category"%>
<%@page import="java.util.ArrayList"%>
<%@page import="fu.abc.model.Error"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>Vnplace - Báo cáo lỗi</title>
	
	<!-- CSS -->
	<link href="css/transcreate.css" rel="stylesheet" type="text/css" media="screen" />
    <link href="css/errorpage.css" rel="stylesheet" type="text/css" media="screen" />
    <link rel="stylesheet" type="text/css" href="css/4.css"/>
    <link href="./content-editor/css/transcreate.css" rel="stylesheet" type="text/css" media="screen" />
    <link href="./content-editor/css/errorpage.css" rel="stylesheet" type="text/css" media="screen" />
    <link rel="stylesheet" type="text/css" href="./content-editor/css/4.css"/>
    
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
	<script language="JavaScript" type="text/javascript" src="js/jquery.js"></script>
    <script language="JavaScript" type="text/javascript" src="js/jts.js"></script>
	<script language="JavaScript" type="text/javascript" src="./content-editor/js/jquery.js"></script>
    <script language="JavaScript" type="text/javascript" src="./content-editor/js/jts.js"></script>
        
         <script>
                $(document).ready(function () {
                
                        $('#demoTable').jTPS( {perPages:[5,12,15,50,'Tất cả'],scrollStep:1,scrollDelay:30,
                                clickCallback:function () {     
                                        // target table selector
                                        var table = '#demoTable';
                                        // store pagination + sort in cookie 
                                        document.cookie = 'jTPS=sortasc:' + $(table + ' .sortableHeader').index($(table + ' .sortAsc')) + ',' +
                                                'sortdesc:' + $(table + ' .sortableHeader').index($(table + ' .sortDesc')) + ',' +
                                                'page:' + $(table + ' .pageSelector').index($(table + ' .hilightPageSelector')) + ';';
                                }
                        });

                        // reinstate sort and pagination if cookie exists
                        var cookies = document.cookie.split(';');
                        for (var ci = 0, cie = cookies.length; ci < cie; ci++) {
                                var cookie = cookies[ci].split('=');
                                if (cookie[0] == 'jTPS') {
                                        var commands = cookie[1].split(',');
                                        for (var cm = 0, cme = commands.length; cm < cme; cm++) {
                                                var command = commands[cm].split(':');
                                                if (command[0] == 'sortasc' && parseInt(command[1]) >= 0) {
                                                        $('#demoTable .sortableHeader:eq(' + parseInt(command[1]) + ')').click();
                                                } else if (command[0] == 'sortdesc' && parseInt(command[1]) >= 0) {
                                                        $('#demoTable .sortableHeader:eq(' + parseInt(command[1]) + ')').click().click();
                                                } else if (command[0] == 'page' && parseInt(command[1]) >= 0) {
                                                        $('#demoTable .pageSelector:eq(' + parseInt(command[1]) + ')').click();
                                                }
                                        }
                                }
                        }

                        // bind mouseover for each tbody row and change cell (td) hover style
                        $('#demoTable tbody tr:not(.stubCell)').bind('mouseover mouseout',
                                function (e) {
                                        // hilight the row
                                        e.type == 'mouseover' ? $(this).children('td').addClass('hilightRow') : $(this).children('td').removeClass('hilightRow');
                                }
                        );

                });


        </script>
        <style>
                #demoTable thead th {
                        white-space: nowrap;
                        overflow-x:hidden;
                        padding: 3px;
                }
                #demoTable tbody td {
                        padding: 3px;
                }
                #count{
		         	margin-top: 20px;
		         	margin-bottom: 20px;
		         	margin-left: 20px;
/* 		         	margin-right: 200px; */
		         }
		         input.sort {
					height: 30px;
					width: 90px;
				}
				select.status{
					height: 28px;
					width: 150px;
				}
				#category{
					height: 28px;
				}
				.link{
					text-decoration: none;
				}
        </style>
</head>

<body class="dt-example">
	<div id="wrapper">
		<!-- h1 tag stays for the logo, you can use the a tag for linking the index page -->
		<div id="header">
		<%String acc = (String)session.getAttribute("acc"); %>
		<ul id="header-menu">
			<li><p class="logo">Content-Editor</p></li>
			<li>
			<%

				if(acc==null){
					response.sendRedirect("/Vnplace/systemAdmin/login.jsp");
				}else{
				
 			%>
				<p class="hello">
					Chào <b><%=acc %></b>
				</p>
				<%} %>
			</li>
			<li><a href="/Vnplace/content-editor/logout.jsp" class="logout">Đăng xuất</a></li>
		</ul>
		</div>

		<!-- // #end mainNav -->

		<div id="containerHolder">
			<div id="container">
				<div id="sidebar">
					<ul class="sideNav">
						<li><a href="/Vnplace/content-editor/contenteditor.jsp">Trang chủ</a></li>
						<li><a href="/Vnplace/content-editor/manageLocation.jsp">Quản lý địa điểm</a></li>
						<li class="create"><a href="/Vnplace/content-editor/manageCategory.jsp" >Quản lý nhóm địa điểm</a></li>
						<li class="error"><a href="/Vnplace/content-editor/manageerror.jsp" >Quản lý lỗi</a></li>
					</ul>
					<!-- // .sideNav -->
				</div>
				<!-- // #sidebar -->
				<div id="link-home">
					<ul id="link-ul">
						<li><a href="">Trang chủ</a></li>
						<li><img src="/Vnplace/content-editor/image/12.png" width="15px" height="25px" class="home"/></li>
						<li><a href="/Vnplace/content-editor/manageerror.jsp">Báo cáo lỗi</a></li>
					</ul>	 
				</div>
				<div id="main">
<!-- 					<section id="main_content" class="inner"> -->
						<div class="title">
							<p class="p-title">Báo cáo vấn đề của hệ thống</p>
						</div>	
						<br/><br/><br/>			
						<hr style="width: 900px;"/>
							<p style="margin-left: 50px;">Thông tin về những vấn đề được người dùng phản hồi khi hệ thống có những thông tin không chính xác.
								 Hoặc hệ thống có lỗi xảy ra</p>
								 <br/>
							<hr style="width: 900px;"/>
							<div>
								<form action="/Vnplace/SearchError" method="post">
									<ul class="ul-sort">
										<li style="margin-top: 5px;"><b style="margin-left: 10px">Trạng thái:</b></li>
										<li>
											<select name="status" class="status">
												<option value="" selected="selected">---- Chọn ----</option>
												<option value="0">Đang chờ</option>
												<option value="1">Đã sửa</option>
											</select>
										</li>
										<li><input type="submit" name="sort" value="Tìm kiếm" class="sort"/></li>
									</ul>
								</form>
							</div>
							<br/>
							<div id="count">
									<b class="count">Có
									<%
										// 	GET data from searcherror
										Object ab = request.getAttribute("listerror");
										if (ab != null) {
											List<Error> list = (ArrayList<Error>) ab;
											int i = 1;
											int count=1;
											int dem = 0;
											for (Error a : list) {
												dem = count++ ;
											} 
									%>
										<%=dem %> kết quả được tìm thấy</b>
								</div>
								<table id="demoTable" style="border: 1px solid #ccc;">
									<thead>
										<tr>
											<td align="center" width="6px">STT</td>
											<td align="center">Tên vấn đề</td>
											<td align="center">Tên địa điểm</td>
<!-- 											<td align="center" width="300px">Nội dung vấn đề</td> -->
											<td align="center">Trạng thái</td>
										</tr>
									</thead>
        							<tbody>
        								<%for (Error a : list) { %>
											<tr>
							                        <td align="center"><%=i++ %></td>
							                        <td><a class="link" href="/Vnplace/content-editor/viewerror.jsp?idlocal=<%=a.getLocation()%>">
							                        	<%=a.getErrorName() %></a></td>
							                        <td><%=a.getLocalName() %></td>
<%-- 							                        <td><%=a.getContent() %></td> --%>
							                        <td><%=a.getStatus() %></td>
							                </tr>
							              <%} 
										}%>
							        </tbody>
							        <tfoot class="nav">
							                <tr>
							                        <td colspan=6>
							                                <div class="pagination"></div>
							                                <div class="paginationTitle">Page</div>
							                                <div class="selectPerPage"></div>
							                                <div class="status"></div>
							                        </td>
							                </tr>
							        </tfoot>
								</table>
							
				</div>
				<!-- // #main -->
			</div>
			<!-- // #container -->
		</div>
		<!-- // #containerHolder -->
		<div id="footer" class="footer">
			<p class="copyright">©Copyright 2014 Vnplace.vn</p>
		</div>
	</div>
	<!-- // #wrapper -->
</body>
</html>
